package com.samehope.ar.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.samehope.ar.entity.PatrolTaskPlan;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.samehope.ar.vo.PatrolTaskPlanDetailVO;
import com.samehope.ar.vo.PatrolTaskPlanWeekDetailVO;
import com.samehope.ar.vo.TaskTimeVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 巡检计划任务 Mapper 接口
 * </p>
 *
 * @author Zhang Luo
 * @since 2019-12-23
 */
public interface PatrolTaskPlanMapper extends BaseMapper<PatrolTaskPlan> {

    PatrolTaskPlan findByTaskPlanName(@Param("companyId")Long companyId
                                      ,@Param("projectId")Long projectId
                                      ,@Param("planId")Long planId
                                      ,@Param("taskNo")String taskNo
                                      ,@Param("taskName")String taskName);

    /**
     * 查找下周需要生成的计划任务
     * @return
     */
    List<PatrolTaskPlanWeekDetailVO> findByEffect();

    /**
     * 查找本周需要生成的计划任务
     * @return
     */
    List<PatrolTaskPlanWeekDetailVO> findByNowEffect(@Param("endDate")String endDate
            , @Param("execStartTime")String execStartTime
            , @Param("execEndTime")String execEndTime
            , @Param("execCount")Integer execCount
            , @Param("execWeek")String execWeek);

    /**
     * 根据项目查找当事人的计划任务
     * @param userId
     * @return
     */
    List<PatrolTaskPlan> findTaskPlanByProjectAndUser(Long userId);

    /**
     * 查询详情
     * @param companyId
     * @param projectId
     * @param planId
     * @return
     */
    PatrolTaskPlanDetailVO findByTaskPlanId(@Param("companyId")Long companyId
            , @Param("projectId")Long projectId
            , @Param("planId")Long planId);

    List<PatrolTaskPlanDetailVO> findByParam(Page<PatrolTaskPlanDetailVO> page
            , @Param("companyId")Long companyId
            , @Param("projectId")Long projectId
            , @Param("teamId")Long teamId
            , @Param("userId")Long userId
            , @Param("startDate")String startDate
            , @Param("endDate")String endDate
            , @Param("taskName")String taskName
            , @Param("taskType")String taskType);
}
